<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>京东的某个商品价格信息</title>
		<script src="js/jquery.min.js"></script>
	</head>
	<body>
		<div>
			商品的编号: <span id="id"></span>
			
			
			
		</div>
		
		<div>
			商品的价格:<span id="price"></span>
			
		</div>
		
		
	</body>
	<script>
		//1.实现写死的JSON字符串
		//var jsonstr='[{"p":"6488.00","op":"6488.00","cbf":"0","id":"J_100012015170","m":"10000.00"}]';
		//2.
		//var obj=JSON.parse(jsonstr);
		
		$.ajax({
			type:"get",
			url:"https://p.3.cn/prices/mgets?skuIds=J_100012015170",
			dataType:"jsonp",
			success:function(data){
				console.log(data);
				var obj=data;
				
				var price=obj[0].p;
				var id=obj[0].id;
				
				console.log(price);
				console.log(id);
				
				//3.
				
				$("#id").text(id);
				$("#id").css("color","blue");
				$("#price").text(price).css("color","violet ");
			}
			
			
		})
		
		
	</script>
</html>
